import {debounce} from './utils'
import BackTop from '../components/content/backTop/BackTop'

export const itemListenerMixin = {
  data() {
    return {
      newRefresh :null,
      itemImgListener: null
    }
  },
  mounted(){
        this.newRefresh= debounce(this.$refs.scroll.refresh,100);
        this.itemImgListener = () => {
          this.newRefresh()
        }
        this.$bus.$on("itemImageLoad", this.newRefresh());
    }
}

export const backTopMiXin = {
    components:{
        BackTop
    },
    data() {
        return {
            isShowBackTop:false,
        }
    },
    methods:{
        backTop() {
            //获取scroll中的scrollTo设定它的滚动距离
            this.$refs.scroll.scrollTo(0, 0,300)
        }
    }
}

